package com.biz.primus.model.promotion.vo;

import com.biz.primus.product.vo.SecProductInfoRespVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 秒杀活动商品Vo
 *
 * @author david-liu
 */
@Getter
@Setter
@ApiModel(value = "秒杀活动商品vo")
public class SeckillProductVo implements Serializable {
    private static final long serialVersionUID = -9116115667535676231L;

    @ApiModelProperty(value = "商品ID")
    private Long productId;

    @ApiModelProperty(value = "商品名称")
    private String productName;

    @ApiModelProperty(value = "商品Logo图")
    private String logo;

    @ApiModelProperty(value = "商品轮播图")
    private List<String> images;

    @ApiModelProperty(value = "商品详情图")
    private List<String> introImages;

    @ApiModelProperty(value = "剩余商品数量")
    private Integer remainQuantity;

    @ApiModelProperty(value = "限购数量(单次秒杀能买多少个)")
    private Integer limitPurchaseQuantity;

    @ApiModelProperty(value = "秒杀价")
    private Integer seckillPrice;

    @ApiModelProperty(value = "商品会员价")
    private Integer memberPrice;

    public SeckillProductVo(SecProductInfoRespVo secProductInfoRespVo, Integer remainQuantity, Integer seckillPrice) {
        this.remainQuantity = remainQuantity;
        this.seckillPrice = seckillPrice;
        this.productId = secProductInfoRespVo.getProductBaseVo().getProductId();
        this.productName = secProductInfoRespVo.getProductBaseVo().getName();
        this.logo = secProductInfoRespVo.getProductBaseVo().getLogo();
        this.images = Arrays.asList(StringUtils.split(secProductInfoRespVo.getProductBaseVo().getImages(), ","));
        this.introImages = Arrays.asList(StringUtils.split(secProductInfoRespVo.getProductBaseVo().getIntroImages(), ","));
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
